Back to Contents Page
Instructions to get the Engduino with Bluetooth Module communicating with
an Android Application made with TouchDevelop using Cordova
Notes
This guide will be using the Android Emulator on the computer to allow for a single set of
instructions. This means that you will need an Intel Processor that supports Intel VT-x. However, if
you choose to develop using an actual device, you will need to enable Android ADB, as well as
setting the device to debug mode. Refer to http://www.redmondpie.com/how-to-set-up-android-adb-
and-fastboot-on-windows-tutorial/
Instructions
1. You will need the Android SDK. (I will be using API 19 Android 4.4.2)
a. Install the latest version of the Java SE Development Kit (JDK)
http://www.oracle.com/technetwork/java/javase/downloads/index.html
b. Install the latest version of the Android SDK Tools
https://developer.android.com/sdk/index.html#Other
i. Make a note of the destination folder (default is
C:\Users\%username%\AppData\Local\Android\android-sdk)
c. Install at least the following:
i. Tools/Android SDK Tools
ii. Tools/Android SDK Platform-tools
iii. Tools/Android SDK Build-tools
iv. Everything under Android 4.4.2 (API 19)
v. Everything under Extras
1. The Intel HAXM module may fail to install. This is not a problem and
addressed in the next step
d. Install Intel HAXM https://software.intel.com/en-us/android/articles/intel-hardware-
accelerated-execution-manager-end-user-license-agreement
i. HAXM is required for Android Emulation on Intel CPUs. It also requires that Intel
VT-x (Virtualisation Technology) is enabled. If installation of HAXM fails, check
your BIOS to see if VT-x is enabled
e. Launch Android AVD Manager and create a new Android Virtual Device
i. Make sure you select Android 4.4.2 API Level 19 as the Target
f. Add the SDK\platform-tools and SDK\tools folders to your System Path Variable where the
SDK is the installed location of the android SDK (by default it is
C:\User\%username%\AppData\Local\Android\sdk)
g. Install Win-ANT v7 https://code.google.com/p/winant/downloads/list
i. This will also require the JDK to be installed
2. The Engduino needs to be set up.
a. Make sure the Bluetooth Module is connected
b. Install the Arduino IDE http://arduino.cc/en/Main/Software
c. Download the Engduino Extension example and libraries from
http://www.engduino.org/index.php?id=7385
d. Copy the files into the Arduino IDE installation location, following the folder layout
e. Open Examples/100.Engduino/Protocol and compile and upload to Engduino
3. The Android phone needs to be set up
a. The Engduino must be paired with the phone beforehand. These Bluetooth modules are
name HC-05 and the PIN code (if prompted) is 1234
b. The Android phone will need have Unknown Sources enabled to allow installation of .apk
files outside of the Play Store
4. Using Cordova
a. Install TouchDevelop locally. https://www.touchdevelop.com/docs/exporttocordova
i. Install Node.JS http://nodejs.org/)
ii. Create a new folder where you would like to allow the local version of
TouchDevelop to build the .apk files
iii. Open command prompt in this folder and use the following command
npm install -g http://aka.ms/touchdevelop.tgz
Note: if you get a npm is not recognised as internal or external command error, then
you need to add ";C:\Program Files\nodejs\" (without quotes or wherever you
installed NodeJS to)to the Path variable in the User variables section in Environment
variables.
iv. Launch TouchDevelop locally
Touchdevelop
b. Click on Search Everything, and look for “emezc” (this is the unique ID given to the
application that I made) The application name is Engduino Bluetooth Accelerometer
https://www.touchdevelop.com/emezc
c. Click on edit, go to script properties and under export, click on Cordova App.
i. If you are using the emulator, local TouchDevelop will launch the emulator, and
once that is complete, will build the apk file. Once finished, it will launch the app in
the emulator. The command prompt will indicate where the file is located, ready to
be copied and installed onto a real phone
ii. As I have been using the Emulator, I do not know exactly what will happen when
using a real phone instead. As such, I suspect the following will occur:
1. The Android phone will not do anything for a bit whilst Cordova creates the
Android project files
2. The computer will compile the application
3. Once complete, it will install the application onto the connected Android
device.
By: David Xiao